home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / readers / skim-0.8 / skim-0 / skim-0.8.4 / GetListOfGroups.c < prev    next >
C/C++ Source or Header  |  1996-02-18  |  2KB  |  65 lines

  1. /*
  2.  * NAME
  3.  *   GetListOfGroups.c
  4.  * USAGE
  5.  *   Usage: GetListOfGroups
  6.  * DESCRIPTION
  7.  *   Retrieve the list of valid newsgroups from the news server.
  8.  * OUTPUT
  9.  *   The list of newsgroups is printed on standard output, one group per line.
  10.  * COPYRIGHT
  11.  *   Skim - Off-line news reading package optimized for slow lines.
  12.  *   Copyright (C) 1996  Rene W.J. Pijlman
  13.  *
  14.  *   This program is free software; you can redistribute it and/or modify
  15.  *   it under the terms of the GNU General Public License as published by
  16.  *   the Free Software Foundation; either version 2 of the License, or
  17.  *   (at your option) any later version.
  18.  * 
  19.  *   This program is distributed in the hope that it will be useful,
  20.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22.  *   GNU General Public License for more details.
  23.  * 
  24.  *   You should have received a copy of the GNU General Public License
  25.  *   along with this program; if not, write to the Free Software
  26.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27.  * VERSION
  28.  *   Skim version 0.8.4.
  29.  */
  30.  
  31. #include <unistd.h>
  32. #include <string.h>
  33.  
  34. #include "Skim.h"
  35. #include "NNTPStream.h"
  36. #include "StandardIO.h"
  37.  
  38. FILE_ID("$Header: /home/rene/sys/CVS_MasterSourceRepository/skim/GetListOfGroups.c,v 1.4 1996/02/17 22:47:30 rene Exp $");
  39.  
  40. int main( int argc, char * argv[] )
  41. {
  42.     StandardIO NewsServer;
  43.  
  44.     if ( argc != 1 )
  45.     {
  46.         SIOPrintf( StandardError, "%s\n", "Usage: GetListOfGroups" );
  47.         exit( EXIT_FAILURE );
  48.     }
  49.  
  50.     NewsServer = NNTPStreamOpen();
  51.  
  52.     SIOInternetCommand( NewsServer, "list" );
  53.     CheckStatusResponse( NewsServer, argv[0], "215", NULL,
  54.                          TERMINATE_ON_ERROR );
  55.  
  56.     /* Write the article in a file. */
  57.     GetTextResponse( NewsServer, NULL, NULL, StandardOutput, NULL );
  58.  
  59.     NNTPStreamClose( NewsServer );
  60.  
  61.     SIOFileClose( StandardOutput );
  62.  
  63.     return EXIT_SUCCESS;
  64. }
  65.